package cc.comac.mom.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import cc.comac.mom.api.EquipBenchmarkService;
import cc.comac.mom.bean.EquipBenchmark;
import cc.comac.mom.bean.EquipBenchmarkBean;
import cc.comac.mom.bean.EquipBenchmarkSelectBean;
import cc.comac.mom.bean.ResultDev;
import cc.comac.mom.util.ResultBean;
import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping(value ="/EquipBenchmark")
public class EquipBenchmarkController {
	@Autowired
	private EquipBenchmarkService equipBenchmarkService;
	
	@RequestMapping(value = "/save",method = RequestMethod.POST)
	public ResultBean save(@RequestBody EquipBenchmarkBean obj) {
		ResultBean	resultBean = equipBenchmarkService.save(obj);
		return resultBean;
	}
	
	@RequestMapping(value = "/update",method = RequestMethod.POST)
	public ResultBean update(@RequestBody EquipBenchmark obj) {
		
		return equipBenchmarkService.update(obj);
		
	}
	
	@RequestMapping(value = "/deleteBatch",method = RequestMethod.POST)
	public ResultBean delete(@RequestBody EquipBenchmarkBean obj) {

			ResultBean resultBean = equipBenchmarkService.deleteBatch(obj);
	
		return resultBean;
		
	}
	@ApiOperation("通过保养基准主键获取保养基准及其详情数据")
	@RequestMapping(value = "/getById",method = RequestMethod.POST)
	public EquipBenchmark getById(@RequestBody EquipBenchmark obj) {
		EquipBenchmark equipBenchmarkList = equipBenchmarkService.getById(obj);
		return equipBenchmarkList;
		
	}
	
	@RequestMapping(value = "/selectByCondition",method = RequestMethod.POST)
	public EquipBenchmarkBean selectByCondition(@RequestBody EquipBenchmark obj) {
		return equipBenchmarkService.selectByCondition(obj);
		
	}
	
	@RequestMapping(value = "/selectByFields",method = RequestMethod.POST)
	public ResultBean selectByFields(@RequestBody EquipBenchmarkSelectBean obj) {
		ResultBean resultBean = new ResultBean(true);
		ResultDev resultDev = equipBenchmarkService.selectByFields(obj);
		resultBean.setObject(resultDev);
		return resultBean;
		
	}
	
	@RequestMapping(value = "/disableEquipBenchmark",method = RequestMethod.POST)
	public ResultBean disableEquipBenchmark(@RequestBody EquipBenchmarkBean obj) {
		return equipBenchmarkService.disableEquipBenchmark(obj);
	}
	
}
